unit CargoDM;

{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
  ZDataset, ZSqlUpdate, ZSequence, MainDM, QueryConditions, db;

type

  { TCargoData }

  TCargoData = class(TMainDataModule)
    CargoDatasource: TDatasource;
    CargoZQuerydesc_cargo: TStringField;
    CargoZQueryid_cargo: TLargeintField;
    CargoZSequence: TZSequence;
    CargoZUpdate: TZUpdateSQL;
    CargoZQuery: TZQuery;
    procedure DataModuleCreate(Sender: TObject);
    /// Abre o DataSet
    procedure OpenDataSet(); override;
    /// Fecha o DataSet
    procedure CloseDataSet(); override;
    /// Realiza busca
    /// @param(Condicoes são as condições para a busca)
    /// @param(Tabela é a tabela no banco de dados)
    procedure Search(Condicoes: TQueryConditions; Tabela: string); override;
  private
    { private declarations }
  public
    { public declarations }
  end;

var
  CargoData: TCargoData;

implementation

uses ConnectionDM;

{ TCargoData }


procedure TCargoData.DataModuleCreate(Sender: TObject);
begin
   MainDataSet := CargoZQuery;
   CargoZQuery.Open;
end;
procedure TCargoData.OpenDataSet;
begin
  //ConnectionData.EmptyQuery(CargoZQuery, 'cargo');
end;

procedure TCargoData.CloseDataSet;
begin
  //CargoZQuery.Close();
end;

procedure TCargoData.Search(Condicoes: TQueryConditions; Tabela: string);
begin
    ConnectionData.OpenQueryConditions(CargoZQuery, Tabela, Condicoes);
end;

initialization
  {$I cargodm.lrs}

end.

